/*
Java source file
Copyright: Umschalt.com 2012
*/
package com.david.documentation.web.view.pages;

import com.david.documentation.domain.entities.doku.Doku;
import com.david.documentation.service.doku.DokuService;
import com.david.documentation.web.BasePage;
import com.david.documentation.web.view.panels.DokuPanel;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.spring.injection.annot.SpringBean;

public class DetailPage extends BasePage{

	@SpringBean
	private DokuService dokuService;

	public DetailPage(PageParameters params){
		super(params);

		 if (params.containsKey("doku")){
			String search = "";
			 if (params.containsKey("search")){
				 search = (String)params.get("search");
			 }
			Doku doku = dokuService.findById(params.getAsLong("doku"));
			add(new DokuPanel("panel",doku,search));
		}else{
			add(new EmptyPanel("panel"));
			setResponsePage(HomePage.class);
		}
	}
}
